import Cart from '../../dbs/models/cart'

module.exports = async (ctx) => {
  // 获取用户传递过来的订单号
  const {
    id
  } = ctx.request.body
  console.log(id)
  try {
    // 根据id查找订单信息
    const result = await Cart.findOne({
      cartNo: id
    })
    ctx.body = {
      code: 0,
      data: result
        ? result.detail[0]
        : {}
    }
  } catch (e) {
    ctx.body = {
      code: -1,
      data: {}
    }
  }
}
